import Book.BookList;
import User.AdiUser;
import User.NorUser;
import User.User;
import java.util.Scanner;

public class Main {
    public static User login(){
        /*System.out.println("欢迎来到图书系统");*/
        System.out.println("请输入姓名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        while (true){
            System.out.println("请输入你的身份： 1，管理员  2，普通用户");
            Scanner scanner1 = new Scanner(System.in);
            int tmp = scanner1.nextInt();
            if(tmp==1){
                return new AdiUser(name);
            }else if(tmp==2){
                return new NorUser(name);
            }else {
                System.out.println("选择有误,请重新选择");
            }
        }
    }
    public static void main(String[] args) {
        BookList bookList = new BookList();
         User user = login();
         while (true){
             int tmp = user.menu();
             user.doWork(tmp,bookList);
         }
    }
}
